package com.cn.lyl.service.impl;

import com.cn.lyl.dao.NavDao;
import com.cn.lyl.dao.impl.NavDaoImpl;
import com.cn.lyl.model.NavModel;
import com.cn.lyl.service.NavService;

import java.util.List;

public class NavServiceImpl implements NavService {
    @Override
    public List<NavModel> findAllNav(NavModel navModel) {
        NavDao navDao = new NavDaoImpl();
        return navDao.findAll(navModel);
    }

    @Override
    public int getCount(NavModel navModel) {
        NavDao navDao = new NavDaoImpl();
        return navDao.countFindAll(navModel);
    }

    @Override
    public String addNav(NavModel navModel) {
        NavDao navDao = new NavDaoImpl();
        return navDao.add(navModel)>0?"success":"error";
    }

    @Override
    public String deleteNav(NavModel navModel) {
        NavDao navDao = new NavDaoImpl();
        return navDao.delete(navModel)>0?"success":"error";
    }

    @Override
    public NavModel findInfo(int id) {
        NavDao navDao = new NavDaoImpl();
        return navDao.findById(id);
    }

    @Override
    public String changeInfo(NavModel navModel) {
        NavDao navDao = new NavDaoImpl();
        return navDao.update(navModel)>0?"success":"error";
    }
}
